<template>
  <div>
    <a-row>
    <a-col :span="12"  class='mb20'>
        <a-input  placeholder="请输入名称"  style='width:200px'  v-model='search.keyWord'/>
        <a-button type="primary" @click='pageInit()'>搜索</a-button>
    </a-col>
  </a-row>
   
  <a-table :columns="columns" :dataSource="data"  :pagination="pagination"   @change="handleTableChange"> 
    <span slot="supOrBuyer"  slot-scope="text, record">{{text | customType}}</span> 
    <span slot="status"  slot-scope="text, record">{{text | audit_status}}</span> 
    <span slot="createTime"  slot-scope="text, record">{{text | formatDates}}</span> 
     
    <span slot="action" slot-scope="text, record"> 
      <router-link  :to='{path:"/olivia/audit_company/audit",query:{code:record.code}}'   class='color-blue'>审核</router-link>
      <a-divider type="vertical" /> 
      <a-popconfirm title="确认删除当前数据？" @confirm="confirmDel(record.code)"   okText="确认" cancelText="取消">
          <a href="javascript:;"  class='color-red'>删除</a>
      </a-popconfirm>
    </span>
  </a-table>
  </div>
</template>

<script>
const  columns  = [
      {
        dataIndex: 'name',
        key: 'name',
        title:'企业名称', 
      }, {
        title: '企业类型',
        dataIndex: 'supOrBuyer',
        scopedSlots: { customRender: 'supOrBuyer' },
      }, {
        title: '登录用户名',
        dataIndex: 'loginName',
      }, {
        title: '联系人',
        dataIndex: 'contact', 
      },{
        title: '联系电话',
        dataIndex: 'mobile', 
      },{
        title: '审核状态',
        dataIndex: 'status', 
        scopedSlots : { customRender : 'status' }
      },{
        title: '创建注册日期',
        dataIndex: 'createTime', 
        scopedSlots: { customRender : 'createTime' }
      },{
        title: '操作',
        dataIndex: 'action',
        scopedSlots: { customRender: 'action' },
      },]
import { toAuditList } from '@/api/olivia'
export default {
  name: 'entInfo',
  data () {
    return {
        columns,
        data:[ 
        ],
        search:{
          keyWord:'',
          pageSize:10,
          pageNo:1
        },
        pagination:{
          total:0,
          pageSize: 10,//每页中显示10条数据
          showSizeChanger: true,

          pageSizeOptions: ["10", "20"],//每页中显示的数据
          showTotal: total => `共有 ${total} 条数据`,  //分页中显示总的数据
        },  
    }
  },
  created(){
     this.pageInit()
  },
  methods:{
    pageInit(){ 
        toAuditList(this.search).then((res)=>{
            if(res.data.flag == true){
              this.data = res.data.dataList
              this.pagination.total = res.data.totalRs
            }
         })
    },
    handleTableChange (pagination, filters, sorter) {
        // console.log(pagination);
        this.search.pageNo = pagination.current
        this.search.pageSize =pagination.pageSize
        this.pageInit()
    },
  },
  computed:{
    
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
